
class Success():
    code = 0
    status="ok"
    msg = "操作成功"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class CreateSuccess():
    code = 0
    status = "create_success"
    msg = "新建数据成功"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class DeleteSuccess():
    code = 0
    status = "delete_success"
    msg = "删除数据成功"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class UpdateSuccess():
    code = 0
    status = "update_success"
    msg = "更新数据成功"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class Failed():
    code = 1010
    status="failed"
    msg = "操作失败"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class CreateFailed():
    code = 1011
    status="create_failed"
    msg = "新建数据失败"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class DeleteFailed():
    code = 1012
    status="delete_failed"
    msg = "删除数据失败"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class UpdateFailed():
    code = 1013
    status="update_failed"
    msg = "更新数据失败"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg


class ServerError():
    code = 5001
    status="server_error"
    msg= "服务器错误"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg


class ClientTypeError():
    code = 4000
    status="400:client_is_invalid"
    msg = "客户端请求无效"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg



class NotFound():
    code = 4040
    status="404:resource_not_found"
    msg = "资源没有找到"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg


class AuthFailed():
    code = 4010
    status="401:authorization_failed"
    msg = "授权失败"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class LoginFailed():
    code = 4007
    status="login_failed"
    msg = '登录失败'
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg 


class Forbidden():
    codo=4030
    status="403:forbidden"
    msg = "访问被禁止"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg


class DBERR():
    code = 4001
    status="database_error"
    msg="数据库请求异常"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class NoData():
    code = 4002
    status="data_is_not_found"
    msg="查询数据为空"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class DataExist():
    code = 4003
    status="data_is_exist"
    msg="数据已存在"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class ParamErr ():
    code = 4013
    status="param_error"
    msg="参数错误"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

class AccountErr ():
    code = 4014
    status="account_or_password_error"
    msg="账号或者是密码错误"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg
    

class IPLimited():
    code = 4202
    status="IP_limited"
    msg="IP访问次数太多,请稍后再试"
    @staticmethod
    def json_msg(data=None):
        code=__class__.code
        msg=__class__.msg
        json_msg={"code":code,"msg":msg,"status":status,"data":data}
        return json_msg

